<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<import type='css' file="Home.Css.activation" />
<load href="__HOMEJS__/Jquery/jquery-1.7.2.min.js" />
<load href="__HOMEJS__/Register.js" />
<title>注册</title>
<script type="text/javascript">
        function emailInputShow(e) {
            if (e && e.stopPropagation) {
                e.stopPropagation();
            }
            else {
                window.event.cancelBubble = true;
            }
            $('#bgdiv').show();
            $("#changeEmail").show(0, function() { $("#codeImage").click(); });
            $("#changeEmailCode").val("");
            $("#cEmail").removeAttr("class").text("此邮箱将作为您登录panli的帐号！");
            $("#cemailinput").val("");
        }

        function changeEmail(e) {
            if (e && e.stopPropagation != undefined) { e.stopPropagation(); }
            else { window.event.cancelBubble = true; }

            var checkCode = $.trim($("#changeEmailCode").val());
            if (checkCode.length <= 0) {
                $("#cEmail").attr("class", "red").text("请输入验证码！"); return;
            }

            $.ajax({
                type: "POST",
                url: "/ValidateCode.ashx?s=ChangeEmailCode&code=" + checkCode,
                dataType: "text",
                timeout: 5000,
                error: function(a, b, c) { checkcodechecked = true; $("#cEmail").removeAttr("class").text("此邮箱将作为您登录panli的帐号！"); changeEmailSuc(); },
                success: function(msg) {
                    if (msg == '0') {
                        $("#cEmail").attr("class", "red").text("验证码错误！"); return;
                    }
                    else {
                        $("#cEmail").removeAttr("class").text("此邮箱将作为您登录panli的帐号！");
                        changeEmailSuc();
                    }
                }
            });
        }


        function changeEmailSuc() {
            var email = $("#cemailinput").val();
            if (email.length <= 0) { $("#cEmail").attr("class", "red").text("请输入您的Email地址！"); return; }
            var reg = new RegExp("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
            if (reg.test($("#cemailinput").val())) {
                $.ajax({
                    type: "POST",
                    url: "/App_Services/wsMember.asmx/ChangeUserEmailLG",
                    dataType: "text",
                    contentType: "application/json;utf-8",
                    data: "{email:'" + email + "'}",
                    timeout: 10000,
                    beforeSend: function() { $("#cEmail").attr("class", "lv").text("正在修改您的Email，请稍候！"); $("#changeEmailBtn").attr("disabled", "disabled"); },
                    error: function() { $("#cEmail").attr("class", "red").text("网络连接失败！"); $("#changeEmailBtn").removeAttr("disabled"); },
                    success: function(res) {
                        var rstr = eval("(" + res + ")").d;
                        if (rstr == "error") { window.location = "/"; return; }
                        if (rstr == "used") { $("#cEmail").attr("class", "red").text("该Email地址已经被使用！"); }
                        if (rstr == "noUser") { $("#cEmail").attr("class", "red").text("Email地址修改失败！"); }
                        if (rstr == "again") { $("#cEmail").attr("class", "red").text("您操作过于频繁，请过10分钟后再试！"); }
                        if (rstr == "success" || rstr == "fail") { $("#cEmail").text("已成功修改您的Email并发送新的激活邮件，请注意查收！"); $("#changeEmail").hide(); $("#registerEmail").html(email); $("#successChange").show(); }
                        if (rstr == "wrong") { $("#cEmail").attr("class", "red").text("您输入的Email地址格式不正确！"); }
                        $("#changeEmailBtn").removeAttr("disabled");
                    }
                });
            }
            else {
                $("#cEmail").attr("class", "red").text("您输入的Email地址不正确！");
            }
        }

        function reSendEmail() {
            $.ajax({
                type: "POST",
                url: "/App_Services/wsMember.asmx/ReSendActivationEmail",
                dataType: "text",
                contentType: "application/json;utf-8",
                data: "{un:'e711729'}",
                timeout: 10000,
                error: function() { alert("网络连接失败，请稍后再试！"); },
                success: function(res) { var resStr = eval("(" + res + ")").d; if (resStr == "success") { alert("新的激活邮件已经发送到您的邮箱，请注意查收！"); } else { if (resStr == "again") alert("您发送邮件过于频繁，请稍后再试"); else alert("激活邮件发送失败！"); } }
            });
        }


        $(document).ready(function() {
            $("#changeEmail").click(function(e) { if (e && e.stopPropagation) { e.stopPropagation(); } else { window.event.cancelBubble = true; } });
            $("#successChange").click(function(e) { if (e && e.stopPropagation) { e.stopPropagation(); } else { window.event.cancelBubble = true; } });
            $(document).click(function(e) {
                if ($("#changeEmail:hidden").length > 0) {
                    //if ($.trim($("#cemailinput").val()).length == 0) $("#cemailinput").attr("class", "c1").val("请输入Email地址");
                    $("#cEmail").removeAttr("class").text("此邮箱将作为您登录panli的帐号！");
                } $("#changeEmail").hide(); $('#bgdiv').hide(); $("#successChange").hide();
            });
        });
    </script>
</head>
<body onload="document.forms[0].action=window.location.href;">
<form name="form1" method="post" action="__URL__/register" id="form1">
    <div class="top">
        <div class="logo">
            <a href="./">
                <img src="__HOMEIMG__/logo.gif" alt="Panli" /></a></div>
        <div class="hy">
            <img src="__HOMEIMG__/hy.gif" alt="" /></div>
        <div class="T_right">
            <a href="./">返回首页</a><span>|</span><a href="./Help.aspx">帮助信息</a>
        </div>
    </div>
	<div class="center">
        <div class="bz">
            <h2>
                只差一步咯，快去激活您的帐户吧！</h2>
            <p>
                系统已重新发送一封激活邮件到您的邮箱：<span>{$email}</span>，请在24小时内激活！</p>
        </div>
        <div class="yaunyin">
            <ul>
                <li>确认邮件是否被你提供的邮箱系统自动拦截，或被误认为垃圾邮件放到垃圾箱了。</li>
                <li>如果超过10分钟您仍然未收到激活信，请您：<b><a href="javascript:;" onclick="reSendEmail()">重发激活信</a></b></li>
                <li class="qu">如果再次发送激活信还没收到，请试试：<b><a href="javascript:;" onclick="emailInputShow(event)">更换其他邮箱</a></b>
                    <div style="display: none;" id="bgdiv" class="floor">
                    </div>
                    <div style="display: none" class="change" id="changeEmail">
                        <a title="关闭" class="close" onclick="$('#changeEmail').hide();$('#bgdiv').hide();" href="javascript:;"></a>
                        <p id="cEmail">此邮箱将作为您登录panli的帐号！</p>
                        <table>
                            <tbody><tr>
                                <td class="zuo">
                                    邮箱地址：
                                </td>
                                <td>
                                    <input type="text" class="c1" id="cemailinput">
                                </td>
                            </tr>
                            <tr>
                                <td class="zuo">
                                    验证码：
                                </td>
                                <td>
                                    <input type="text" id="changeEmailCode" class="c3"><img border="0" onclick="this.src='__URL__/verify/t/'+Math.random();" style="vertical-align:middle;cursor:pointer;" alt="验证码" title="点击图片刷新" src="__URL__/verify/" id="codeImage">
                                </td>
                            </tr>
                        </tbody></table>
                        <input type="button" onmouseout="this.className='c2'" onmouseover="this.className='c2_'" value="确定发送" name="" onclick="changeEmail(event);" class="c2" id="changeEmailBtn">
                    </div>
                    <div style="display: none" class="change" id="successChange">
                        <a title="关闭" class="close" onclick="$('#successChange').hide();$('#bgdiv').hide();" href="javascript:;"></a>
                        <div class="ch_top">
                            已向您的新邮箱发送验证邮件！<br>
                            点击邮件中的链接地址，即可完成验证！
                        </div>
                        <p class="tishi">
                            此邮箱将作为您登录panli的帐号！</p>
                    </div>
                    
                </li>
            </ul>
        </div>
        <div class="yj">
        </div>
    </div>

    <div class="bottom">
    </div>
    <div class="foot">
        <p>
            <a href="#" target="_blank">关于Panli</a>&nbsp;|&nbsp;
			<a href="#">联系我们</a>&nbsp;|&nbsp;
        </p>
        Copyright &copy;2012 Preorderchina Inc. All rights reserved.
    </div>
    </form>
</body>
</html>
